package com.thinker.interview.dynamic_datasource.dynamic_datasource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "region")
public class RegionController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping(value = "db")
    public String getDB() {
        return jdbcTemplate.queryForObject("SELECT DATABASE()", String.class);
    }
}
